package com.kx.test;

import com.kx.my04.SomeService;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MyTest04 {
    @Test
    public void test(){
        String config="applicationContext.xml";
        ApplicationContext ctx=new ClassPathXmlApplicationContext(config);
        //从容器中获取目标对象
        SomeService proxy= (SomeService) ctx.getBean("someService");

        //proxy:com.sun.proxy.$Proxy6   ：jdk动态代理
        System.out.println("proxy:"+proxy.getClass().getName());
        //通过代理对象执行方法，实现目标方法执行时，增强了功能
        proxy.doSecond();
    }
}
